//=============================================================================
// Class: KEG::Bitfont
//  For bitmap fonts. Loads from the font directory.
//  Bitfont > Frames > Image
// 
//
// Bodhi Crandall-Rus (boder.us)
// Sept 10, 2006
//=============================================================================

#ifndef BITFONT_HPP
#define BITFONT_HPP

#include <vector>
#include <deque>
/////////////////////////////////////////////
#include "glee.h"
/////////////////////////////////////////////
#include "common.hpp"
/////////////////////////////////////////////
#include "texture.hpp"
#include "tiletexture.hpp"

namespace KEG
{
	
class BitFont
{
public:
	BitFont() : padding(0), nativew(0), nativeh(0) {}
	bool Load( const std::string& filename, int padding_ = 0 );
	void Reset( int sizew_ = 0, int sizeh_ = 0, int padding_ = 0 );
	float Height() { return sizeh; }
	float CalcStringWidth( const std::string& str ) { return str.size()*(sizew+padding) - 1.0f; }
	void RenderText( const std::string& str, float x, float y );
	void RenderTextCentered( const std::string& str, float y, float totalwidth );
	//float RenderChar( char c, float x, float y, int sizew_, int sizeh_, int padding_ );
	void Release();
	~BitFont();
private:
	std::deque< char > validChar;
	std::vector< GLuint > dispListIndex;
	KEG::TileTexture texData;
	KEG::Texture texture;
	float padding;

	float nativew;
	float nativeh;
	float sizew;
	float sizeh;
};

}

#endif
